package 设计模式.简单工厂;

public class factory {

    public food create(String type) throws Exception {
        switch (type){
            case "1":return new 雪糕();
            case "2":return new 鸡肉();
            default:throw new Exception("what");
        }
    }
}
